package com.awenhui.demo.core.utils.icbc;

import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URLDecoder;
import java.util.*;

/**
 * @author yuxf
 * @version 1.0
 * @date 2020/7/27 16:32
 */
public class HttpRequestParamsUtils {
    private static final List<String> apiParamNames = new ArrayList();

    public HttpRequestParamsUtils() {
    }
    public static boolean isApiParam(String paramName) {
        return apiParamNames.contains(paramName);
    }


    public static Map<String, String> parseRawParams(String paramStr) {
        String[] pairs = paramStr.split("&");
        Map<String, String> paramMap = new HashMap();
        String[] var3 = pairs;
        int var4 = pairs.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            String pair = var3[var5];
            int index = pair.indexOf(61);
            String name = pair.substring(0, index);
            String value = pair.substring(index + 1);
            paramMap.put(name, value);
        }

        return paramMap;
    }
    static {
        apiParamNames.add("sign");
        apiParamNames.add("app_id");
        apiParamNames.add("sign_type");
        apiParamNames.add("charset");
        apiParamNames.add("format");
        apiParamNames.add("encrypt_type");
        apiParamNames.add("timestamp");
        apiParamNames.add("msg_id");
    }
}
